home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 424 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  50 lines

  1. Path: chronicle.mti.sgi.com!austern
  2. From: balu@netcom.com (Balasubramanian)
  3. Newsgroups: comp.std.c++
  4. Subject: pointer conversions from the null pointer constant
  5. Date: 20 Feb 1996 10:51:57 PST
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <baluDn1pGL.8J1@netcom.com>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. X-Original-Date: Mon, 19 Feb 1996 23:05:09 GMT
  11. Apparently-To: comp-std-c++@uunet.uu.net
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBVAwUBMSoYZky4NqrwXLNJAQEONwIAmT5ulblslboLdXf41GdA1i9Ho4md6vQn
  14.     lEDGouHNaoORBf5piJNzksMdgQv2+3mtbmHNE4acx+Pci6A+62X2CQ==
  15.     =U4lq
  16. Originator: austern@isolde.mti.sgi.com
  17.  
  18. Given the following:
  19.  
  20. class A {};
  21. class B : public A {};
  22. class C : public B {};
  23.  
  24. void foo(A*) { ... }
  25.  
  26. void foo(C*) { ... }
  27.  
  28. int main() {foo(0); return 0;}
  29.  
  30. How is the call to foo() in main() to be resolved? It seemed obvious
  31. to me that the call should be ambiguous but some compilers resolve
  32. it as a call to foo(C*) (while others reject it as ambiguous.)
  33.  
  34. Is the conversion of the null pointer constant to C* 
  35. better than its conversion to A*? I couldn't find anything
  36. in the ARM or the draft standard (May 1995) to support this 
  37. interpretation.
  38.  
  39. Thanks.
  40.  
  41.  
  42.     - balu
  43. ---
  44. [ To submit articles: Try just posting with your newsreader.  If that fails,
  45.                       use mailto:std-c++@ncar.ucar.edu
  46.   FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  47.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  48.   Comments? mailto:std.c++-request@ncar.ucar.edu 
  49. ]
  50.